package com.xpqh.ksg.modular.caseInfo.controller;


import com.xpqh.ksg.base.BaseController;
import com.xpqh.ksg.base.BaseResponseDTO;
import com.xpqh.ksg.modular.caseInfo.dto.KsgCaseDetailsReqDTO;
import com.xpqh.ksg.modular.caseInfo.dto.KsgCaseListReqDTO;
import com.xpqh.ksg.modular.caseInfo.dto.KsgCaseListReqDTO2;
import com.xpqh.ksg.modular.caseInfo.dto.KsgDictListReqDTO;
import com.xpqh.ksg.modular.caseInfo.service.CaseInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 案例相关接口
 */
@RestController
@RequestMapping("/ksg/caseInfo")
public class CaseInfoController extends BaseController {

    @Autowired
    private CaseInfoService caseInfoService;

    @PostMapping("/list")
    public BaseResponseDTO list(@Valid @RequestBody KsgCaseListReqDTO2 req) {
        return renderResultOk(caseInfoService.getCaseList2(req.getVehicleBrand(),req.getVehicleModel(),req.getProductSeries(),req.getSearch(),req.getCaseType(),req.getClassification(),req.getOrder(),req.getLabel(),req.getPageNo(),req.getPageSize()));
    }

    @PostMapping("/details")
    public BaseResponseDTO details(@Valid @RequestBody KsgCaseDetailsReqDTO req) {
        return renderResultOk(caseInfoService.getCaseDetails(req.getCaseId()));
    }

    @PostMapping("/dictList")
    public BaseResponseDTO dictList(@Valid @RequestBody KsgDictListReqDTO req) {
        return renderResultOk(caseInfoService.getDictList(req.getDictName()));
    }

}
